Serial communications between master and slave devices sometimes rely on timing to determine the beginning and end of a communication. For example, the Modbus communication protocol employs a master-slave arrangement in which the master initiates all communication activity. In this arrangement, the master sends a command to the slave. The slave waits for a period of time, typically 3.5 characters, before responding. If the master does not send any other data after the period of time, the slave is allowed to send a response. This arrangement ensures that only the master or the slave is communicating at a given time. Other communication protocols employ similar timing constraints such as the Highway Addressable Remote Transducer (HART) protocol. The HART protocol is a multi-master protocol with various timing constraints, such as the slave time-out (STO), link grant RT1, and link quiet RT2, that determine when a device on the network can communicate.
The serial communications are typically transmitted through a Universal Asynchronous Receiver/Transmitter (UART) that sequentially transmits binary data. For example, a program on the master may generate a command that conforms to the Modbus standard and send the command through the UART. The slave can receive the binary data with the slave's UART. The UART can provide the binary data to the slave's program or embedded system, which can interpret the binary data according to the Modbus standard. The slave can then generate a response to the command and send it through the UART to the master. The response is then interpreted by the master according to the Modbus standard. Similar methods can be employed with other serial communication protocols.
As can be appreciated, the correct interpretation of the sequentially transmitted binary data must be according to the serial communication protocols. The communication protocols can define timing intervals such as the time to complete a communication, wait periods between receiving and transmitting, bit sizes of fields in the communication, or the like. For example, if the master's UART transmits a request packet, where there is a gap in the binary data (an intervening one-character silence), the slave will not see this as two independent request packets. If the gap exceeds 3.5 character times, then the slave will incorrectly see this as two independent request packets.
The Universal Serial Bus (USB) is gradually replacing older UART-based serial communication protocols as a de-facto hardware standard. For example, many computers that functioned as masters in the UART-based serial communication protocols are being replaced by computers with USB interfaces. However, programs that employ the UART-based serial communication protocols are still being utilized in many applications. To communicate through the USB interfaces, the serial communications are ‘stacked’ on a virtual UART layer and transmitted over the USB interface according to the USB standard.
However, when UART-based serial communications that rely on timing are transmitted over the USB interface, timing errors can result when the communications are interpreted. Accordingly, there is a need for a stack timing adjustment for serial communications.